<?php
// +----------------------------------------------------------------------
// | B5Yii2CMF V3.0 [快捷通用基础管理开发平台]
// +----------------------------------------------------------------------
// | Author: 冰舞 <357145480@qq.com>
// +----------------------------------------------------------------------
declare (strict_types=1);

namespace common\models\system;

/**
 * This is the model class for table "sys_city".
 *
 * @property int $id
 * @property int $level 级别
 * @property int $parent_id 父级ID
 * @property string $area_code 区号
 * @property string $name 名称
 * @property string $short_name 简称
 * @property string $merge_name 合并名称
 * @property string $status 状态
 */
class City extends \yii\db\ActiveRecord
{

    /**
     * {@inheritdoc}
     */
    public static function tableName(): string
    {
        return 'sys_city';
    }

    /**
     * {@inheritdoc}
     */
    public function rules(): array
    {
        return [
            [['area_code', 'name', 'short_name'], 'default', 'value' => ''],
            [['parent_id'], 'default', 'value' => 0],
            [['status'], 'default', 'value' => '1'],

            [['name', 'short_name', 'area_code'], 'required'],

            [['parent_id'], 'integer', 'min' => 0],
            [['area_code'], 'string', 'max' => 16],
            [['name'], 'string', 'max' => 64],
            [['short_name'], 'string', 'max' => 32],
            ['status', 'in', 'range' => ['0', '1']],
        ];
    }

    /**
     * {@inheritdoc}
     */
    public function attributeLabels(): array
    {
        return [
            'id' => 'ID',
            'name' => '名称',
            'area_code' => '区号',
            'short_name' => '简称',
            'merge_name' => '合并名称',
            'status' => '状态',
            'level' => '级别',
            'parent_id' => '父级ID',
        ];
    }

}
